package source.collections;

public final class Histogram {
	
	
	private final long[] upperBounds;
	
	private final long[] counts;
	
	private long minValue = Long.MAX_VALUE;
	
	private	long maxValue = 0L;
	
	public Histogram(final long[] upperBounds){
		
		validateBounds(upperBounds);
		this.upperBounds = upperBounds;
		this.counts = new long[upperBounds.length];
	}

	private void validateBounds(final long[] upperBounds2) {
		long lastBound = 1L;
		if(upperBounds.length <= 0)
		{
			throw new IllegalArgumentException("必须提供最少一个~");
		}
		for(final long bound : upperBounds)
		{
			if(bound <= 0L)
			{
				throw new IllegalArgumentException("必须为正数");
			}
			if(bound <= lastBound)
			{
				throw new IllegalArgumentException("必须依次递增");
			}
			
			lastBound = bound;
		}
	}
	
	/**
	 *	获取这个 边界槽的 长度
	 */
	public int getSize()
	{
		return upperBounds.length;
	}
	
	/***
	 * 获取指定位置的 边界
	 * @param index
	 * @return
	 */
	public long getUpperBoundAt(final int index)
	{
		return upperBounds[index];
	}
	
	public static void main(String[] args) {
		long[] a = new long[2];
		System.out.println(a[1]++);//0
		System.out.println(a[1]++);//1
	}
}
